package com.uzai.console.web.pyq;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.dto.pyq.pyqgoods.PyqJobBatchSendDao;
import com.uzai.console.dto.pyq.pyqgoods.PyqJobSendDao;
import com.uzai.console.dto.pyq.pyqgoods.PyqTbGoodsQuery;
import com.uzai.console.service.pyq.PyqGoodsService;
import com.uzai.console.service.qiniu.QiniuService;
import com.uzai.console.vo.base.SelectIdVo;
import com.uzai.console.vo.pyq.pyqgoods.PyqTbGoodsResultVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 朋友圈商品列表
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "商品列表",tags = "个人微信|朋友圈|商品列表")
@ApiSort(31)
@RestController
public class PyqGoodsController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(PyqGoodsController.class);

    @Autowired
    private PyqGoodsService pyqGoodsService;
    @Autowired
    private QiniuService qiniuService;

    @ApiOperation(value = "分页查询淘宝商品列表", notes = "分页查询淘宝商品列表", response = PyqTbGoodsResultVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/pyqTbGoods/findPyqTbGoodsList")
    public Object findPyqTbGoodsList(@RequestBody PyqTbGoodsQuery pyqTbGoodsQuery){
        pyqTbGoodsQuery.setSize(50);//默认查询50条
        return pyqGoodsService.findPyqTbGoodsList(pyqTbGoodsQuery);
    }

    @ApiOperation(value = "查询淘宝商品一级类目", notes = "查询淘宝商品一级类目", response = SelectIdVo.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/pyqTbGoods/findCmsTbGoodsFirstTypeList")
    public Object findCmsTbGoodsFirstTypeList(){
        return pyqGoodsService.findCmsTbGoodsFirstTypeList();
    }

    @ApiOperation(value = "批量商品发送朋友圈任务", notes = "批量商品发送朋友圈任务")
    @ApiOperationSupport(order = 3)
    @PostMapping("/pyqTbGoods/batchSendPyqJpb")
    public Object batchSendPyqJpb(@RequestBody PyqJobBatchSendDao pyqJobBatchSendDao){
         pyqGoodsService.batchSendPyqJpb(pyqJobBatchSendDao);
        return true;
    }

    @ApiOperation(value = "单个商品发送朋友圈任务", notes = "单个商品发送朋友圈任务")
    @ApiOperationSupport(order = 4)
    @PostMapping("/pyqTbGoods/sendPyqJpb")
    public Object sendPyqJpb(@RequestBody PyqJobSendDao pyqJobSendDao){
        pyqGoodsService.sendPyqJpb(pyqJobSendDao);
        return true;
    }

}
